import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_app/generated/json/base/json_field.dart';
import 'package:flutter_app/generated/json/problem_check_type_entity.g.dart';
import 'package:get/get.dart';
import 'package:image_pickers/image_pickers.dart';

import 'file_path_entity.dart';

@JsonSerializable()
class ProblemCheckTypeEntity {
  List<ProblemCheckTypeProblemTypeList>? problemTypeList; // 问题清单
  List<ProblemCheckTypeProblemTypeList>? taskTypeList; // 任务清单

  ProblemCheckTypeEntity();

  factory ProblemCheckTypeEntity.fromJson(Map<String, dynamic> json) =>
      $ProblemCheckTypeEntityFromJson(json);

  Map<String, dynamic> toJson() => $ProblemCheckTypeEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class ProblemCheckTypeProblemTypeList {
  List<ChildTypeList>? childTypeList;
  String? code;
  String? id;
  String? name;
  String? pid;
  String? problemCount;
  List<ProblemSubmitList>? problemSubmitList;
  String? type;

  int isExist = 1;

  RxBool isExpand = false.obs;
  AnimationController? animCtrl;

  ProblemCheckTypeProblemTypeList();

  factory ProblemCheckTypeProblemTypeList.fromJson(Map<String, dynamic> json) =>
      $ProblemCheckTypeProblemTypeListFromJson(json);

  Map<String, dynamic> toJson() => $ProblemCheckTypeProblemTypeListToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class ChildTypeList {
  String? code;
  String? id;
  String? name;
  String? pid;
  String? problemCount;
  List<ProblemSubmitList>? problemSubmitList;

  var isChoosed = false.obs;

  ChildTypeList();

  factory ChildTypeList.fromJson(Map<String, dynamic> json) =>
      $ChildTypeListFromJson(json);

  Map<String, dynamic> toJson() => $ChildTypeListToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class ProblemSubmitList {
  String? collectId;
  String? content;
  String? createBy;
  String? createTime;
  String? groupId;
  String? id;
  String? isSelf;
  String? orgId;
  String? orgName;
  String? problemCode;
  String? problemCodeName;
  String? problemId;
  String? status;
  List<FilePathEntity>? fileList;
  List<Media>? imagesList;

  ProblemSubmitList();

  factory ProblemSubmitList.fromJson(Map<String, dynamic> json) =>
      $ProblemSubmitListFromJson(json);

  Map<String, dynamic> toJson() => $ProblemSubmitListToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
